<template>
	<!-- <statusBarVue title="地址管理" :isShowBar="true" :isShowLeft="true" /> -->
	<view class="mall-address-page">
		<view class="mall-address-page-group">
			<radio-group @change="radioChange" class="mall-address-list" v-if="addressList.length">
				<view class="mall-address-list-item" v-for="(v,i) in addressList" :key="i" >
					<view class="tit">
						{{ v.name }}
						{{ v.phone }}
					</view>
					<view class="address">
						{{ v.address }}
					</view>
					<view class="btns">
						<label class="radio">
							<radio :value="i" class="radio-btn" :checked="i === current" />设为默认
						</label>
						<view class="btn-group">
							<button class="btn">删除</button>
							<button class="btn">复制</button>
							<button class="btn">修改</button>
						</view>
					</view>
				</view>
			</radio-group>
			<view class="mall-address-none" v-else>
				<view class="text">
					暂无收货地址
				</view>
			</view>
		</view>
		<view class="mall-address-page-footer">
			<buton class="add-address-btn">新增收货地址</buton>
		</view>
	</view>
</template>

<script>
	import statusBarVue from '@/components/statusBar.vue';
	import {
		publics
	} from '@/mixins/publics.js';

	export default {
		mixins: [publics],
		components: {
			statusBarVue
		},
		data() {
			return {
				current: 0, // 默认地址选择
				addressList: [{
						name: '十月、',
						phone: '17384839393',
						address: '江苏 苏州市 苏州',
						id: 0
					},
					{
						name: '十月、',
						phone: '17384839393',
						address: '江苏 苏州市 苏州',
						id: 1
					}
				]
			}
		},
		methods: {
			radioChange(evt) {
				this.current = evt.detail.value;
			}
		}
	}
</script>

<style lang="scss">
	.mall-address-page {
		position: relative;
		font-family: "Arial";

		&-group {
			width: 93.33%;
			margin: auto;

			.mall-address-list,
			.mall-address-none {
				height: 90vh;
				overflow: auto;

				.mall-address-list-item {
					padding: 24rpx 28rpx;
					box-sizing: border-box;
					width: 100%;
					background: #FFFFFF;
					border-radius: 24rpx;
					margin-top: 28rpx;

					.tit {
						font-family: PingFangSC-Semibold;
						font-weight: 600;
						font-size: 32rpx;
						color: #1B1B1B;
					}

					.address {
						margin: 18rpx 0 40rpx;
						font-family: PingFangSC-Regular;
						font-weight: 400;
						font-size: 28rpx;
						color: #222222;
					}

					.btns {
						display: flex;
						justify-content: space-between;
						align-items: center;

						.radio {
							font-family: PingFangSC-Regular;
							font-weight: 400;
							font-size: 24rpx;
							color: #5B5B5B;
							display: flex;
							align-items: center;

							.radio-btn {
								transform: scale(0.7)
							}
						}

						.btn-group {
							display: flex;
							justify-content: space-between;
							align-items: center;
							width: 50%;

							.btn {
								background: #F6F6F6;
								border-radius: 8rpx;
								padding: 0rpx 18rpx;
								font-family: PingFangSC-Regular;
								font-weight: 400;
								font-size: 24rpx;
								color: #1B1B1B;
								height: 46rpx;
								line-height: 46rpx;

								&:after {
									border: none;
								}
							}
						}
					}
				}
			}

			.mall-address-none {
				text-align: center;

				.text {
					color: #999999;
					font-size: 44rpx;
					font-family: "PingFang SC Regular";
					line-height: 44rpx;
				}
			}
		}

		.mall-address-page-footer {
			padding: 14rpx 34rpx calc(10vh - 28rpx - env(safe-area-inset-bottom));
			background-color: #fff;
			box-sizing: border-box;

			.add-address-btn {
				display: block;
				width: 100%;
				height: 76rpx;
				line-height: 76rpx;
				background: #22A366;
				border-radius: 8rpx;
				font-family: PingFangSC-Regular;
				font-weight: 400;
				font-size: 28rpx;
				color: #FFFFFF;
				text-align: center;
			}
		}
	}
</style>